﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace 简易计算器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
        //将“确定”选项隐藏
        private void button2_Click(object sender, EventArgs e)
        {
            this.richTextBox1.Hide();
            this.button2.Hide();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "+")
            {
                this.richTextBox1.Visible = true;
                this.button2.Visible = true;
                richTextBox1.Text = (double.Parse(textBox1.Text) + double.Parse(textBox3.Text)).ToString();
            }

            if (textBox2.Text == "-")
            {
                this.richTextBox1.Visible = true;
                this.button2.Visible = true;
                richTextBox1.Text = (double.Parse(textBox1.Text) - double.Parse(textBox3.Text)).ToString();
            }

            if (textBox2.Text == "*")
            {
                this.richTextBox1.Visible = true;
                this.button2.Visible = true;
                richTextBox1.Text = (double.Parse(textBox1.Text) * double.Parse(textBox3.Text)).ToString();
            }

            if (textBox2.Text == "/")
            {
                this.richTextBox1.Visible = true;
                this.button2.Visible = true;
                richTextBox1.Text = (double.Parse(textBox1.Text) / double.Parse(textBox3.Text)).ToString();
            }
        }

        private void 说明ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("适用于计算简易加减乘除，运算符号为：加+,减-，乘*，除/");
        }
    }
}
